cmake_minimum_required(VERSION 3.22)            #指定版本
project(crtsurfdata)                             #项目名字
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} SRC_LISTS)     #收集一个文件夹下面所有的文件，把那些文件存成一个变量
#set(SRC_LISTS ${SRC_LISTS} ${CMAKE_CURRENT_SOURCE_DIR}/../../public/_public.cpp)
list(APPEND SRC_LISTS ${SRC_LISTS} ${CMAKE_CURRENT_SOURCE_DIR}/../../public/_public.cpp)

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/output)  #设置可执行文件生成的地址


list(REMOVE_ITEM SRC_LISTS ${CMAKE_CURRENT_SOURCE_DIR}/ls.cpp ${CMAKE_CURRENT_SOURCE_DIR}/procctl.cpp ${CMAKE_CURRENT_SOURCE_DIR}/shareMem.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Sem2.cpp ${CMAKE_CURRENT_SOURCE_DIR}/Sem.cpp
${CMAKE_CURRENT_SOURCE_DIR}/active.cpp ${CMAKE_CURRENT_SOURCE_DIR}/checkproc.cpp  ${CMAKE_CURRENT_SOURCE_DIR}/gzipfiles.cpp ${CMAKE_CURRENT_SOURCE_DIR}/deletefiles.cpp
)

#list(APPEND SRC_LISTS ${SRC_LISTS} ${CMAKE_CURRENT_SOURCE_DIR}/../../public/_public.cpp)

add_executable(thread ${SRC_LISTS})                         #生成可执行文件


# 显式指定编译器
set(CMAKE_CXX_COMPILER "g++")                                                                   #设置编译器


# 开启调试信息
set(CMAKE_BUILD_TYPE "Debug")
set(CMAKE_CXX_FLAGS_DEBUG "$ENV{CXXFLAGS} -O0 -Wall -g2 -ggdb")
set(CMAKE_CXX_FLAGS_RELEASE "$ENV{CXXFLAGS} -O3 -Wall")

# 开启所有警告
set(CMAKE_CXX_FLAGS "-Wall -std=c++17 -lpthread")